//响应拦截器
import { CallHandler, Injectable, NestInterceptor } from "@nestjs/common";
import { map } from 'rxjs/operators';
import { Observable } from "rxjs";
interface data<T> {
    data: T
}
@Injectable()
export class Response<T> implements NestInterceptor {
    intercept(context, next: CallHandler): Observable<data<T>> {

        return next.handle().pipe(map(data => {
            return {
                data,
                status: 200,
                success: true,
                message: "成功"
            }
        }))
    }
}